# Contributor: Fabricio Silva <hi@fabricio.dev>
# Maintainer: Fabricio Silva <hi@fabricio.dev>
pkgname=py3-qbittorrent-api
pkgver=2023.11.57
pkgrel=0
pkgdesc="Python client implementation for qBittorrent's Web API"
url="https://github.com/rmartin16/qbittorrent-api"
arch="noarch"
license="MIT"
depends="
	py3-requests
	py3-setuptools
	"
makedepends="
	py3-gpep517
	py3-wheel
	py3-setuptools_scm
	py3-sphinx-copybutton
	py3-sphinx-autodoc-typehints
	"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rmartin16/qbittorrent-api/archive/v$pkgver.tar.gz"
builddir="$srcdir/qbittorrent-api-$pkgver"
# tests requires an instance of qbittorrent running
# net for sphinx
options="net !check"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
	sphinx-build -W -b man docs/source docs/build
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	install -Dm644 docs/build/qbittorrent-api.1 -t "$pkgdir"/usr/share/man/man1

	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/tests
}

sha512sums="
2446c3c5e2d2817a9863227f5c60c0efe9ec5a8fe16e62ca3ebad3a9bdb1e0f2b7f970816065148026a933bfc0185af6c2103602471947dddb2cf57cf3fab6d5  py3-qbittorrent-api-2023.11.57.tar.gz
"
